package animal;

public class Dog extends Animal {
    //属性:性别
    private String sex;
    //无参构造
    public Dog(){

    }
    //带参构造
    public Dog(String name,int month,String sex){
        //相当于super(name,month);
        this.setName(name);
        this.setAge(month);
        this.setSex(sex);
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    //方法:睡觉
    public String sleep(){
        String str="小狗有午睡的习惯";
        return str;
    }

    //方法:吃东西(重写父类方法)
    //父类中的eat()方法是抽象方法,子类必须重写该方法
    @Override
    public String eat() {
        String str="狗吃肉~~";
        return str;
    }
}
